package top.forforever.srb.sms.prop;

import lombok.Data;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * @create: 2023/5/3
 * @Description:
 * @FileName: SmsProperties
 * @自定义内容：
 */
@Data
@Component
@ConfigurationProperties(prefix = "aliyun.sms")
public class SmsProperties implements InitializingBean {

    public static String REGION_ID;
    public static String KEY_ID;
    public static String KEY_SECRET;
    public static String SIGN_NAME;
    public static String TEMPLATE_CODE;
    public static String SYS_DOMAIN;
    public static String SYS_ACTION;

    private String regionId;
    private String keyId;
    private String keySecret;
    private String signName;
    private String templateCode;
    private String sysDomain;
    private String sysAction;

    @Override
    public void afterPropertiesSet() throws Exception {
        System.out.println("赋值完后执行，给常量赋值");
        REGION_ID = regionId;
        KEY_ID = keyId;
        KEY_SECRET = keySecret;
        SIGN_NAME = signName;
        TEMPLATE_CODE = templateCode;
        SYS_DOMAIN = sysDomain;
        SYS_ACTION = sysAction;
    }
}


